package gcj2011.round1c;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;

import common.AbstractRunner;
import common.AbstractRunner.SIZE;

public class C extends AbstractRunner {
	BigInteger MAX = new BigInteger("10000000000000000");
	double eps = 0;
	
	long nod(long a, long b) {
		long c = a % b;
		while (c != 0) {
			a = b;
			b = c;
			c = a % b;
		}
		return b;
	}
	
	long nok(long a, long b) {
		BigInteger res = new BigInteger(Long.toString(a))
			.multiply(new BigInteger(Long.toString(b)))
			.divide(new BigInteger(Long.toString(nod(a,b))));
		
		if (res.compareTo(MAX) == 1) {
			return Long.MAX_VALUE;
		} else {
			return res.longValue();
		}
	}
	
	private long trySolve(long lo, long hi, long nok, long nod) {
		if (nok <= 0 || nod % nok != 0) {
			return -1;
		}
		
		for (long i = Math.max(lo, 1); i<= Math.min(hi, Math.sqrt(nod)); i++) {
			if (nod % i == 0 && i % nok == 0) {				
				return i;
			}
		}
		
		for (long i = Math.round(Math.sqrt(nod)); i>=1; i--) {
			if (nod % i == 0) {
				long x = nod / i;
				if (x>= lo && x <= hi && x % nok == 0) {
					return x;
				}
			}
		}
		return -1;
	}
	
	@Override
	public void handleCase(int caseNumber) throws Exception {		
		int n = scanner.nextInt();
		long l = scanner.nextLong();
		long h = scanner.nextLong();
		long a[] = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextLong();
		}
		//if (caseNumber != 27) return;
		//suxx solve
//		long suxxsolve = -1;
//		cycle: for (long i=l; i<=h; i++) {
//			for (int j=0; j<n; j++) {
//				if (a[j] % i != 0 && i % a[j] != 0) {
//					continue cycle;
//				}
//			}
//			suxxsolve = i;
//			break;
//		}
//		out.write("suxsolve: "+suxxsolve+" ");
		
		Arrays.sort(a);
		
		long nod[] = new long[n];
		long nok[] = new long[n+1];
		
		//nok
		nok[0] = 1;			
		for (int i=1; i<=n; i++) {
			if (nok[i-1] > 0) {
				nok[i] = nok(nok[i-1], a[i-1]);
				if (nok[i] > h) {
					nok[i] = -1;
				}
			} else {
				nok[i] = -1;
			}
		}
		
		//nod
		nod[n-1] = a[n-1];		
		for (int i=n-2; i>=0; i--) {			
			nod[i] = nod(nod[i+1], a[i]);			
		}				
		
		
		System.out.println("\n---------------------------------------------------------------\n");
		System.out.println("Case:"+caseNumber+", l="+l+", h="+h);
		System.out.println("A[i]: "+ Arrays.toString(a));
		System.out.println("Nok: "+ Arrays.toString(nok));
		System.out.println("Nod: "+ Arrays.toString(nod));
		System.out.println();
		
		

		//between solves	
		for (int i=0; i<=n-1; i++) {
			//System.out.println("Case "+caseNumber+", trySolve: "+i);
			long solve = trySolve(l, h, nok[i], nod[i]);
			if (solve > 0) {
				println(solve);
				return;
			}			
		}
		
		
		//nok solve
		if (nok[n] > 0) {
			double divl = ((double)l) / nok[n];					
			long res = ((long)Math.ceil(divl))*nok[n];			
			if (res >= l && res <= h) {
				println(res);
				return;
			}
		}
		
		 
		println("NO\n");
		return;
		
	}
	
	public static void main(String[] args) throws Exception {
		//new C().init(SIZE.large).execute();
		
		long l = 9999999999999997l;
		System.out.println((double)l);
	}

}
